package cn.tanglong.user.controller;

import cn.tanglong.basic.util.AjaxResult;
import cn.tanglong.user.service.IVerifycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    private IVerifycodeService verifycodeService;

    @RequestMapping("/sendSmsCode")
    public AjaxResult SmsCode(@RequestBody Map<String, String> param){
        try {
            verifycodeService.smsCode(param);
            return AjaxResult.me();
        }catch (Exception e){
            e.printStackTrace();
            return new AjaxResult().me().setMsg("操作失败！");
        }
    }
}
